// $ANTLR : "SyntaxAnalyzer.g" -> "SyntaxAnalyzer.java"$

  package pl.p03;

import antlr.TokenBuffer;
import antlr.TokenStreamException;
import antlr.TokenStreamIOException;
import antlr.ANTLRException;
import antlr.LLkParser;
import antlr.Token;
import antlr.TokenStream;
import antlr.RecognitionException;
import antlr.NoViableAltException;
import antlr.MismatchedTokenException;
import antlr.SemanticException;
import antlr.ParserSharedInputState;
import antlr.collections.impl.BitSet;

public class SyntaxAnalyzer extends antlr.LLkParser       implements SyntaxAnalyzerTokenTypes
 {

  
  
protected SyntaxAnalyzer(TokenBuffer tokenBuf, int k) {
  super(tokenBuf,k);
  tokenNames = _tokenNames;
}

public SyntaxAnalyzer(TokenBuffer tokenBuf) {
  this(tokenBuf,1);
}

protected SyntaxAnalyzer(TokenStream lexer, int k) {
  super(lexer,k);
  tokenNames = _tokenNames;
}

public SyntaxAnalyzer(TokenStream lexer) {
  this(lexer,1);
}

public SyntaxAnalyzer(ParserSharedInputState state) {
  super(state,1);
  tokenNames = _tokenNames;
}

	public final void start() throws RecognitionException, TokenStreamException {
		
		
		{
		_loop2211:
		do {
			if ((_tokenSet_0.member(LA(1)))) {
				sentencia();
			}
			else {
				break _loop2211;
			}
			
		} while (true);
		}
		match(Token.EOF_TYPE);
	}
	
	public final void sentencia() throws RecognitionException, TokenStreamException {
		
		
		{
		switch ( LA(1)) {
		case ID:
		{
			asignacion();
			match(PUNTO_COMA);
			break;
		}
		case SET:
		{
			set();
			match(PUNTO_COMA);
			break;
		}
		case IF:
		{
			condicion();
			break;
		}
		case FOR:
		{
			bucle_for();
			break;
		}
		case WHILE:
		{
			bucle_while();
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		}
		}
	}
	
	public final void start_kb() throws RecognitionException, TokenStreamException {
		
		
		{
		_loop2214:
		do {
			if ((_tokenSet_0.member(LA(1)))) {
				sentencia_kb();
			}
			else {
				break _loop2214;
			}
			
		} while (true);
		}
		match(Token.EOF_TYPE);
	}
	
	public final void sentencia_kb() throws RecognitionException, TokenStreamException {
		
		
		{
		switch ( LA(1)) {
		case ID:
		{
			asignacion();
			break;
		}
		case SET:
		{
			set();
			break;
		}
		case IF:
		{
			condicion_kb();
			break;
		}
		case FOR:
		{
			bucle_for_kb();
			break;
		}
		case WHILE:
		{
			bucle_while_kb();
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		}
		}
	}
	
	public final void asignacion() throws RecognitionException, TokenStreamException {
		
		
		match(ID);
		match(OP_ASIG);
		valor();
	}
	
	public final void set() throws RecognitionException, TokenStreamException {
		
		
		match(SET);
		match(USERVAR);
		match(OP_ASIG);
		valor();
	}
	
	public final void condicion() throws RecognitionException, TokenStreamException {
		
		
		match(IF);
		match(PARENT_A);
		{
		switch ( LA(1)) {
		case ID:
		{
			match(ID);
			break;
		}
		case USERVAR:
		{
			match(USERVAR);
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		}
		}
		match(PARENT_C);
		match(LLAVE_A);
		{
		int _cnt2224=0;
		_loop2224:
		do {
			if ((_tokenSet_0.member(LA(1)))) {
				sentencia();
				match(PUNTO_COMA);
			}
			else {
				if ( _cnt2224>=1 ) { break _loop2224; } else {throw new NoViableAltException(LT(1), getFilename());}
			}
			
			_cnt2224++;
		} while (true);
		}
		match(LLAVE_C);
	}
	
	public final void bucle_for() throws RecognitionException, TokenStreamException {
		
		
		match(FOR);
		match(PARENT_A);
		match(ID);
		match(OP_ASIG);
		match(NUMERO);
		match(TO);
		match(NUMERO);
		match(PARENT_C);
		match(LLAVE_A);
		{
		int _cnt2231=0;
		_loop2231:
		do {
			if ((_tokenSet_0.member(LA(1)))) {
				sentencia();
				match(PUNTO_COMA);
			}
			else {
				if ( _cnt2231>=1 ) { break _loop2231; } else {throw new NoViableAltException(LT(1), getFilename());}
			}
			
			_cnt2231++;
		} while (true);
		}
		match(LLAVE_C);
	}
	
	public final void bucle_while() throws RecognitionException, TokenStreamException {
		
		
		match(WHILE);
		match(PARENT_A);
		{
		switch ( LA(1)) {
		case ID:
		{
			match(ID);
			break;
		}
		case USERVAR:
		{
			match(USERVAR);
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		}
		}
		match(PARENT_C);
		match(LLAVE_A);
		{
		int _cnt2238=0;
		_loop2238:
		do {
			if ((_tokenSet_0.member(LA(1)))) {
				sentencia();
				match(PUNTO_COMA);
			}
			else {
				if ( _cnt2238>=1 ) { break _loop2238; } else {throw new NoViableAltException(LT(1), getFilename());}
			}
			
			_cnt2238++;
		} while (true);
		}
		match(LLAVE_C);
	}
	
	public final void condicion_kb() throws RecognitionException, TokenStreamException {
		
		
		match(IF);
		match(PARENT_A);
		{
		switch ( LA(1)) {
		case ID:
		{
			match(ID);
			break;
		}
		case USERVAR:
		{
			match(USERVAR);
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		}
		}
		match(PARENT_C);
		match(LLAVE_A);
		{
		int _cnt2228=0;
		_loop2228:
		do {
			if ((_tokenSet_0.member(LA(1)))) {
				sentencia_kb();
			}
			else {
				if ( _cnt2228>=1 ) { break _loop2228; } else {throw new NoViableAltException(LT(1), getFilename());}
			}
			
			_cnt2228++;
		} while (true);
		}
		match(LLAVE_C);
	}
	
	public final void bucle_for_kb() throws RecognitionException, TokenStreamException {
		
		
		match(FOR);
		match(PARENT_A);
		match(ID);
		match(OP_ASIG);
		match(NUMERO);
		match(TO);
		match(NUMERO);
		match(PARENT_C);
		match(LLAVE_A);
		{
		int _cnt2234=0;
		_loop2234:
		do {
			if ((_tokenSet_0.member(LA(1)))) {
				sentencia_kb();
			}
			else {
				if ( _cnt2234>=1 ) { break _loop2234; } else {throw new NoViableAltException(LT(1), getFilename());}
			}
			
			_cnt2234++;
		} while (true);
		}
		match(LLAVE_C);
	}
	
	public final void bucle_while_kb() throws RecognitionException, TokenStreamException {
		
		
		match(WHILE);
		match(PARENT_A);
		{
		switch ( LA(1)) {
		case ID:
		{
			match(ID);
			break;
		}
		case USERVAR:
		{
			match(USERVAR);
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		}
		}
		match(PARENT_C);
		match(LLAVE_A);
		{
		int _cnt2242=0;
		_loop2242:
		do {
			if ((_tokenSet_0.member(LA(1)))) {
				sentencia_kb();
			}
			else {
				if ( _cnt2242>=1 ) { break _loop2242; } else {throw new NoViableAltException(LT(1), getFilename());}
			}
			
			_cnt2242++;
		} while (true);
		}
		match(LLAVE_C);
	}
	
	public final void valor() throws RecognitionException, TokenStreamException {
		
		
		{
		switch ( LA(1)) {
		case NUMERO:
		{
			match(NUMERO);
			break;
		}
		case BOOLEAN:
		{
			match(BOOLEAN);
			break;
		}
		case DIR:
		{
			match(DIR);
			break;
		}
		case STRING:
		{
			match(STRING);
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		}
		}
	}
	
	
	public static final String[] _tokenNames = {
		"<0>",
		"EOF",
		"<2>",
		"NULL_TREE_LOOKAHEAD",
		"NL",
		"BLANCO",
		"LETRA",
		"DIGITO",
		"ID",
		"NUMERO",
		"BOOLEAN",
		"DIR",
		"STRING",
		"SET",
		"USERVAR",
		"IF",
		"FOR",
		"TO",
		"WHILE",
		"PUNTO_COMA",
		"LLAVE_A",
		"LLAVE_C",
		"PARENT_A",
		"PARENT_C",
		"OP_ASIG"
	};
	
	private static final long[] mk_tokenSet_0() {
		long[] data = { 368896L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
	
	}
